window.onload = function () {
    var cars = ["Saab", "Volvo", "BMW", "Volkswagon", "Benz", "Toyota", "Audi", "Renault"];
    cars[1]="AAAAAAAAAAAAAAAAAAA";
    cars[100]="assfds";
    var a = cars.shift();
    var appendix = document.getElementById("appendix")
    appendix.innerHTML += a + "<br>";
    appendix.innerHTML += cars + "<br><br>";
    var b = cars.pop();
    appendix.innerHTML += b + "<br>";
    appendix.innerHTML += cars + "<br><br>"
    var c = cars.push("Mazda","Mazda2","Mazda3");
    appendix.innerHTML += c + "<br>";
    appendix.innerHTML += cars + "<br><br>"
    var d = cars.unshift("Honda","Honda2","Honda3");
    appendix.innerHTML += d + "<br>";
    appendix.innerHTML += cars + "<br><br>"
    var cars4=cars.reverse();
    console.log(cars4);
    cars4.pop();cars4.pop();
    cars4.push("1243543245234523452345");
    appendix.innerHTML += cars + "<br><br>"
    var cars2 = cars.slice(1, 3);
    appendix.innerHTML += cars2 + "<br><br>"
    var cars3 = cars.slice(3, 1);
    appendix.innerHTML += cars3 + "<br><br>"
    var e = cars.sort()
    appendix.innerHTML += e + "<br>";
    appendix.innerHTML += cars + "<br><br>"

    var appendix2 = document.createElement("div");
    appendix.appendChild(appendix2);
    appendix2.innerHTML += cars;

    appendix.innerHTML += add(1, 2) + "<br>";
    appendix.innerHTML += add("123", "24") + "<br>";
    appendix.innerHTML += add(1, 1.2) + "<br>";

    var num=[1,3,2,5];
    num.sort();
    console.log(num);
    num.sort((a, b) => a - b)
    console.log(num);
}

function add(a, b) {
    return a + b;
}
